package clazz.generic;

import java.io.Serializable;

/**
 * @author 李栋
 * @createtime
 */
public class BackResult<T> implements Serializable {


    private static final long serialVersionUID = -3993616366635772300L;

    // 数据
    private final T data;

    // 响应码
    private final String code;

    // 消息
    private final String message;

    public BackResult(T data, String code, String message) {
        this.data = data;
        this.code = code;
        this.message = message;
    }

    public static <T> BackResult<T> success(T data, String message) {
        return new BackResult<>(data, "200", message);
    }

    public static <T> BackResult<T> failure(String message){
        return new BackResult<>(null,"500",message);
    }

}
